﻿
using RakutenCrawler.ConfigClass;
using log4net;
using RakutenCrawler.Repository;
namespace RakutenCrawler.PageProcessors
{
    public abstract class PageProcessor
    {
        protected ILog log = LogManager.GetLogger("Rakuten");

        public LinkConfig LinkConfig { get; set; }

        private int _linkId;
        public int LinkId
        {
            get { return _linkId; }
            set 
            {
                if (_linkId == value)
                    return;

                _linkId = value;
                using (var linkRepo = new LinkRepository())
                {
                    _link = linkRepo.Single(l => l.LinkId == _linkId);
                }
            }
        }

        private Link _link;
        public Link Link 
        {
            get { return _link; }
        }


        public abstract bool Execute();
    }
}
